package com.sys.SysSales.service.impl;

import java.util.List;

import com.sys.common.utils.DateUtils;
import com.sys.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sys.SysSales.mapper.SysSalesInventoryMapper;
import com.sys.SysSales.domain.SysSalesInventory;
import com.sys.SysSales.service.ISysSalesInventoryService;

/**
 * 产品库存Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-26
 */
@Service
public class SysSalesInventoryServiceImpl implements ISysSalesInventoryService 
{
    @Autowired
    private SysSalesInventoryMapper sysSalesInventoryMapper;

    /**
     * 查询产品库存
     * 
     * @param inventoryId 产品库存主键
     * @return 产品库存
     */
    @Override
    public SysSalesInventory selectSysSalesInventoryByInventoryId(Long inventoryId)
    {
        return sysSalesInventoryMapper.selectSysSalesInventoryByInventoryId(inventoryId);
    }

    /**
     * 查询产品库存列表
     * 
     * @param sysSalesInventory 产品库存
     * @return 产品库存
     */
    @Override
    public List<SysSalesInventory> selectSysSalesInventoryList(SysSalesInventory sysSalesInventory)
    {
        return sysSalesInventoryMapper.selectSysSalesInventoryList(sysSalesInventory);
    }

    /**
     * 新增产品库存
     * 
     * @param sysSalesInventory 产品库存
     * @return 结果
     */
    @Override
    public int insertSysSalesInventory(SysSalesInventory sysSalesInventory)
    {
        sysSalesInventory.setCreateTime(DateUtils.getNowDate());
        sysSalesInventory.setUpdateTime(DateUtils.getNowDate());
        sysSalesInventory.setCreatedBy(SecurityUtils.getUsername());
        sysSalesInventory.setUpdatedBy(SecurityUtils.getUsername());
        return sysSalesInventoryMapper.insertSysSalesInventory(sysSalesInventory);
    }

    /**
     * 修改产品库存
     * 
     * @param sysSalesInventory 产品库存
     * @return 结果
     */
    @Override
    public int updateSysSalesInventory(SysSalesInventory sysSalesInventory)
    {
        return sysSalesInventoryMapper.updateSysSalesInventory(sysSalesInventory);
    }

    /**
     * 批量删除产品库存
     * 
     * @param inventoryIds 需要删除的产品库存主键
     * @return 结果
     */
    @Override
    public int deleteSysSalesInventoryByInventoryIds(Long[] inventoryIds)
    {
        return sysSalesInventoryMapper.deleteSysSalesInventoryByInventoryIds(inventoryIds);
    }

    /**
     * 删除产品库存信息
     * 
     * @param inventoryId 产品库存主键
     * @return 结果
     */
    @Override
    public int deleteSysSalesInventoryByInventoryId(Long inventoryId)
    {
        return sysSalesInventoryMapper.deleteSysSalesInventoryByInventoryId(inventoryId);
    }
}
